package com.hxci.liminshuo.servcie;

import com.hxci.liminshuo.dao.MinShuoUserMapper;
import com.hxci.liminshuo.pojo.MinShuoUser;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MinShuoUserServiceImpl implements MinShuoUserServcie {  // 修正实现的接口
    @Autowired
    private MinShuoUserMapper dao;

    @Override
    public Integer logion(String name, String pass, HttpServletRequest request) {  // 修正方法名
        MinShuoUser user = dao.login(name, pass);  // 修正方法调用
        if(user == null) {
            return 0;
        }
        //登录成功后将用户存到session中
        request.getSession().setAttribute("user", user);
        return 1;
    }
}
